// house_pkg/pages/locate/index.ts
Page({
  async onLoad() {
    this.search()
    this.nowLocation()
  },
  data: {
    list: [],
    address: '',
  },
  async nowLocation() {
    const { latitude, longitude } = await wx.getLocation({
      type: 'gcj02',
    })
    wx.qqMapSdk.reverseGeocoder({
      location: {
        latitude,
        longitude,
      },
      success: (res) => {
        this.setData({
          address: res.result.address,
        })
      },
    })
  },
  search() {
    wx.qqMapSdk.search({
      keyword: '小区',
      page_size: 5,
      success: (res) => {
        this.setData({
          list: res.data,
        })
      },
    })
  },
})
